/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "film")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Film.findAll", query = "SELECT f FROM Film f"),
    @NamedQuery(name = "Film.findByIdFilm", query = "SELECT f FROM Film f WHERE f.idFilm = :idFilm"),
    @NamedQuery(name = "Film.findByAdFilm", query = "SELECT f FROM Film f WHERE f.adFilm = :adFilm"),
    @NamedQuery(name = "Film.findByYapimci", query = "SELECT f FROM Film f WHERE f.yapimci = :yapimci"),
    @NamedQuery(name = "Film.findByYayinTarih", query = "SELECT f FROM Film f WHERE f.yayinTarih = :yayinTarih"),
    @NamedQuery(name = "Film.findBySure", query = "SELECT f FROM Film f WHERE f.sure = :sure"),
    @NamedQuery(name = "Film.findByActive", query = "SELECT f FROM Film f WHERE f.active = :active")})
public class Film implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idFilm")
    private Integer idFilm;
    @Basic(optional = false)
    @Column(name = "adFilm")
    private String adFilm;
    @Column(name = "yapimci")
    private String yapimci;
    @Column(name = "yayinTarih")
    @Temporal(TemporalType.DATE)
    private Date yayinTarih;
    @Basic(optional = false)
    @Column(name = "sure")
    @Temporal(TemporalType.TIME)
    private Date sure;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @JoinColumn(name = "tipId", referencedColumnName = "idFilmTipleri")
    @ManyToOne(optional = false)
    private Filmtipleri tipId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "filmId")
    private Collection<Seans> seansCollection;

    public Film() {
    }

    public Film(Integer idFilm) {
        this.idFilm = idFilm;
    }

    public Film(Integer idFilm, String adFilm, Date sure, boolean active) {
        this.idFilm = idFilm;
        this.adFilm = adFilm;
        this.sure = sure;
        this.active = active;
    }

    public Integer getIdFilm() {
        return idFilm;
    }

    public void setIdFilm(Integer idFilm) {
        this.idFilm = idFilm;
    }

    public String getAdFilm() {
        return adFilm;
    }

    public void setAdFilm(String adFilm) {
        this.adFilm = adFilm;
    }

    public String getYapimci() {
        return yapimci;
    }

    public void setYapimci(String yapimci) {
        this.yapimci = yapimci;
    }

    public Date getYayinTarih() {
        return yayinTarih;
    }

    public void setYayinTarih(Date yayinTarih) {
        this.yayinTarih = yayinTarih;
    }

    public Date getSure() {
        return sure;
    }

    public void setSure(Date sure) {
        this.sure = sure;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Filmtipleri getTipId() {
        return tipId;
    }

    public void setTipId(Filmtipleri tipId) {
        this.tipId = tipId;
    }

    @XmlTransient
    public Collection<Seans> getSeansCollection() {
        return seansCollection;
    }

    public void setSeansCollection(Collection<Seans> seansCollection) {
        this.seansCollection = seansCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFilm != null ? idFilm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Film)) {
            return false;
        }
        Film other = (Film) object;
        if ((this.idFilm == null && other.idFilm != null) || (this.idFilm != null && !this.idFilm.equals(other.idFilm))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Film[ idFilm=" + idFilm + " ]";
    }
    
}
